home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group94a.txt / 000138_icon-group-sender _Tue May 24 08:13:20 1994.msg < prev    next >
Internet Message Format  |  1994-08-19  |  2KB

  1. Received: by cheltenham.cs.arizona.edu; Tue, 24 May 1994 15:01:55 MST
  2. Date: Tue, 24 May 94 08:13:20 PDT
  3. From: kwalker@sirtur.premenos.com (Ken Walker)
  4. Message-Id: <9405241513.AA01092@sirtur.premenos.com>
  5. To: TENAGLIA@MIS.MCW.EDU, icon-group@cs.arizona.edu
  6. Subject: Re: wishlist?
  7. X-Sun-Charset: US-ASCII
  8. Content-Length: 1155
  9. Status: R
  10. Errors-To: icon-group-errors@cs.arizona.edu
  11.  
  12. > From: Chris Tenaglia - 257-8765 <TENAGLIA@MIS.MCW.EDU>
  13. >               every n := 0.0 to &pi*2.0 by &pi/180.0 do ...
  14. >   'every' cannot increment by reals. It can only do integers, strings,
  15. >   and structures.
  16.  
  17. Technically speaking the problem is not with 'every'; the problem is
  18. with 'to by'. This is illustrated by writing a toby() procedure that
  19. mimics 'to by', but works fine with reals:
  20.  
  21. procedure toby(From, To, By)
  22.     /By := 1
  23.  
  24.     if From < To then {
  25.         if By <= 0 then
  26.             stop("infinite sequence specified for toby()")
  27.         while From <= To do {
  28.             suspend From
  29.             From +:= By
  30.             }
  31.         }
  32.     else {
  33.         if By >= 0 then
  34.             stop("infinite sequence specified for toby()")
  35.         while From >= To do {
  36.             suspend From
  37.             From +:= By
  38.             }
  39.         }
  40. end
  41.  
  42. procedure main()
  43.    local From, To, By
  44.  
  45.    repeat {
  46.        writes("from ")
  47.        From := read() | stop()
  48.        writes("to ")
  49.        To := read() | stop()
  50.        writes("by ")
  51.        By := read() | stop()
  52.        every write("  ", toby(From, To, By))
  53.        }
  54. end
  55.  
  56.  
  57. Ken Walker, kwalker@premenos.com
  58.